<?php
namespace Home\Controller;

use Common\Library\SiteDao;
use Think\Controller;

class PageController extends Controller{

    /*
     * 企业站显示主页功能
     * */
    public function page(){

        //通过域名解析站点
        if ($_SERVER['HTTP_HOST'] != 'www.demo.com') {
            $site = SiteDao::FetchByDomain($_SERVER['HTTP_HOST']);
        }
        //通过GET参数解析
        else {
            $site = SiteDao::FetchByName(I('get.site'));
        }

        //查找站点信息
        if (empty($site)){
            $this->error('404,您访问的页面不存在');
        }

        else{
            $this->assign('SiteInfo',$site);
            $this->theme($site->skin)->display('page');
        }
    }
}

